<template>
	<div class="step1">
		<ul class="uls">
			<template v-if="Array.isArray(manageRate) && manageRate.length">
				<li class="lis">
					<div class="div1">
						<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.feeRateAlgorithm">
							<el-form slot="reference">
								<el-form-item label="管理费算法" required>
									<span v-if="['6'].includes(dataType)">
										<span style="color: red" v-if="publicCompare('feeRateAlgorithm', '管理费算法', 'rateInfo')">(未复核)</span>
									</span>
								</el-form-item>
							</el-form>
						</el-popover>
					</div>
					<div class="div3">
						<el-select
							v-model="rateInfo.feeRateAlgorithm"
							placeholder="请选择"
							:disabled="isBaseDisabled"
							@change="changeFeeRateAlgorith"
							filterable
							clearable
						>
							<el-option value="" label="--请选择--"></el-option>
							<el-option
								v-for="(item, index) in productDictList.feeRateAlgorithm"
								:key="index + 'a'"
								:label="item.typeName"
								:value="item.typeCode"
							>
							</el-option>
						</el-select>
						<div class="blurmsg" v-if="isCheck && !!!rateInfo.feeRateAlgorithm">请选择管理费算法</div>
					</div>
				</li>

				<li class="lis">
					<div class="div1">
						<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.managementRate">
							<el-form slot="reference">
								<el-form-item label="" :required="!!rateInfo.feeRateAlgorithm && rateInfo.feeRateAlgorithm === '2'" class="slotlabel">
									<span slot="label">
										管理费率
										<span v-if="['6'].includes(dataType)">
											<span class="infoClass" v-if="feeRateCCompare(manageRate[0].feeRateType, `管理费率`)"> (未复核) </span>
										</span>
										<br />
										<span class="infoClass" v-if="rateInfo.feeRateAlgorithm === '1'">(若选择浮动管理费率，则填写基本管理费)</span>
									</span>
								</el-form-item>
							</el-form>
						</el-popover>
					</div>
					<div class="div3">
						<el-input v-model="manageRate[0].feeRate" @input="scale(manageRate[0], 'feeRate')" type="text" :disabled="isBaseDisabled">
							<el-select v-model="manageRate[0].feeRateUnit" slot="append" :disabled="isBaseDisabled">
								<el-option label="%" value="1"></el-option>
								<el-option label="元/笔" value="2"></el-option>
							</el-select>
						</el-input>
						<div
							class="blurmsg"
							v-if="isCheck && !!!manageRate[0].feeRate && !!rateInfo.feeRateAlgorithm && rateInfo.feeRateAlgorithm === '2'"
						>
							请输入管理费率
						</div>
					</div>
				</li>

				<li class="lis">
					<div class="div1">
						<el-popover
							placement="top-start"
							width="200"
							trigger="hover"
							:content="$store.getters.hoverPerty.rateInfo.managementRateRemark"
						>
							<el-form slot="reference">
								<el-form-item label="" class="slotlabel">
									<span slot="label">
										管理费率备注
										<span v-if="['6'].includes(dataType)">
											<span class="infoClass" v-if="feeRateCCompare(manageRate[0].feeRateType, `管理费率备注`)">
												(未复核)
											</span>
										</span>
										<br />
										<span class="infoClass" v-if="rateInfo.feeRateAlgorithm === '1'"
											>(若选择浮动管理费率，则填写基本管理费备注)</span
										>
									</span>
								</el-form-item>
							</el-form>
						</el-popover>
					</div>
					<div class="div3">
						<el-input type="textarea" v-model="manageRate[0].remark" :disabled="isBaseDisabled" show-word-limit style="width: 100%" />
					</div>
				</li>
			</template>

			<template v-if="Array.isArray(trusteeRate) && trusteeRate.length">
				<li class="lis">
					<div class="div1">
						<el-popover
							placement="top-start"
							width="200"
							trigger="hover"
							:content="$store.getters.hoverPerty.rateInfo.custodyFeeAlgorithm"
						>
							<el-form slot="reference">
								<el-form-item label="托管费算法" required>
									<span v-if="['6'].includes(dataType)">
										<span style="color: red" v-if="publicCompare('custodyFeeAlgorithm', '托管费算法', 'rateInfo')">(未复核)</span>
									</span>
								</el-form-item>
							</el-form>
						</el-popover>
					</div>
					<div class="div3">
						<el-select v-model="rateInfo.custodyFeeAlgorithm" placeholder="请选择" :disabled="isBaseDisabled" filterable clearable>
							<el-option value="" label="--请选择--"></el-option>
							<el-option
								v-for="(item, index) in productDictList.custodyFeeAlgorithm"
								:key="index + 'a'"
								:label="item.typeName"
								:value="item.typeCode"
							>
							</el-option>
						</el-select>
						<div class="blurmsg" v-if="isCheck && !!!rateInfo.custodyFeeAlgorithm">请选择托管费算法</div>
					</div>
				</li>

				<li class="lis">
					<div class="div1">
						<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.escrowRate">
							<el-form slot="reference">
								<el-form-item
									label=""
									:required="!!rateInfo.custodyFeeAlgorithm && rateInfo.custodyFeeAlgorithm === '1'"
									class="slotlabel"
								>
									<span slot="label">
										托管费率
										<span v-if="['6'].includes(dataType)">
											<span class="infoClass" v-if="feeRateCCompare(trusteeRate[0].feeRateType, `托管费率`)">(未复核)</span>
										</span>
										<br />
										<span class="infoClass" v-if="rateInfo.custodyFeeAlgorithm === '3'"
											>(若选择浮动托管费率，则填写基本托管费)</span
										>
									</span>
								</el-form-item>
							</el-form>
						</el-popover>
					</div>
					<div class="div3">
						<el-input v-model="trusteeRate[0].feeRate" @input="scale(trusteeRate[0], 'feeRate')" :disabled="isBaseDisabled">
							<el-select v-model="trusteeRate[0].feeRateUnit" slot="append" :disabled="isBaseDisabled">
								<el-option label="%" value="1"></el-option>
								<el-option label="元/笔" value="2"></el-option>
							</el-select>
						</el-input>
						<div
							class="blurmsg"
							v-if="isCheck && !!!trusteeRate[0].feeRate && !!rateInfo.custodyFeeAlgorithm && rateInfo.custodyFeeAlgorithm === '1'"
						>
							请输入托管费率
						</div>
					</div>
				</li>

				<li class="lis">
					<div class="div1">
						<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.escrowRateRemark">
							<el-form slot="reference">
								<el-form-item label="" class="slotlabel">
									<span slot="label">
										托管费率备注
										<span v-if="['6'].includes(dataType)">
											<span class="infoClass" v-if="feeRateCCompare(trusteeRate[0].feeRateType, `托管费率备注`)">(未复核)</span>
										</span>
										<br />
										<span class="infoClass" v-if="rateInfo.custodyFeeAlgorithm === '3'"
											>(若选择浮动托管费率，则填写基本托管费备注)</span
										>
									</span>
								</el-form-item>
							</el-form>
						</el-popover>
					</div>
					<div class="div3">
						<el-input type="textarea" v-model="trusteeRate[0].remark" :disabled="isBaseDisabled" show-word-limit style="width: 100%" />
					</div>
				</li>
			</template>

			<template v-if="Array.isArray(salesSerivceRate) && salesSerivceRate.length">
				<li class="lis">
					<div class="div1">
						<el-popover
							placement="top-start"
							width="200"
							trigger="hover"
							:content="$store.getters.hoverPerty.rateInfo.salesServiceFeeAlgorithm"
						>
							<el-form slot="reference">
								<el-form-item :label="`销售服务费算法`" required>
									<span v-if="['6'].includes(dataType)">
										<span style="color: red" v-if="feeRateCCompare(salesSerivceRate[0].feeRateType, '销售服务费算法')"
											>(未复核)</span
										>
									</span>
								</el-form-item>
							</el-form>
						</el-popover>
					</div>
					<div class="div3">
						<el-select
							v-model="salesSerivceRate[0].salesServiceFeeAlgorithm"
							placeholder="请选择"
							:disabled="isBaseDisabled"
							filterable
							clearable
							@change="saleChan()"
						>
							<el-option value="" label="--请选择--"></el-option>
							<el-option
								v-for="(item, index) in productDictList.salesServiceFeeAlgorithm"
								:key="index + 'a'"
								:label="item.typeName"
								:value="item.typeCode"
							>
							</el-option>
						</el-select>
						<div class="blurmsg" v-if="isCheck && !!!salesSerivceRate[0].salesServiceFeeAlgorithm">请选择销售服务费算法</div>
					</div>
				</li>

				<li class="lis">
					<div class="div1">
						<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.salesServiceRate">
							<el-form slot="reference">
								<el-form-item label="" :required="salesSerivceRate[0].salesServiceFeeAlgorithm === '2'" class="slotlabel">
									<span slot="label">
										销售服务费率
										<span v-if="['6'].includes(dataType)">
											<span class="infoClass" v-if="feeRateCCompare('8', `销售服务费率`)">(未复核)</span>
										</span>
										<br />
										<span
											class="infoClass"
											v-if="
												Array.isArray(salesSerivceRate) &&
												salesSerivceRate.length &&
												salesSerivceRate[0].salesServiceFeeAlgorithm === '4'
											"
											>(若选择浮动销售服务费率，则填写基本销售服务费)</span
										>
									</span>
								</el-form-item>
							</el-form>
						</el-popover>
					</div>
					<div class="div3">
						<el-input
							v-model="salesSerivceRate[0].feeRate"
							@input="scale(salesSerivceRate[0], 'feeRate')"
							:disabled="isBaseDisabled || salesSerivceRate[0].salesServiceFeeAlgorithm === '1'"
						>
							<el-select v-model="salesSerivceRate[0].feeRateUnit" slot="append" :disabled="isBaseDisabled">
								<el-option label="%" value="1"></el-option>
								<el-option label="元/笔" value="2"></el-option>
							</el-select>
						</el-input>
						<div class="blurmsg" v-if="isCheck && !!!salesSerivceRate[0].feeRate && salesSerivceRate[0].salesServiceFeeAlgorithm === '2'">
							请输入销售服务费率
						</div>
					</div>
				</li>

				<li class="lis">
					<div class="div1">
						<el-popover
							placement="top-start"
							width="200"
							trigger="hover"
							:content="$store.getters.hoverPerty.rateInfo.salesServiceRateRemark"
						>
							<el-form slot="reference">
								<el-form-item label="" class="slotlabel">
									<span slot="label">
										销售服务费率备注
										<span v-if="['6'].includes(dataType)">
											<span class="infoClass" v-if="feeRateCCompare('8', `销售服务费率备注`)">(未复核)</span>
										</span>
										<br />
										<span
											class="infoClass"
											v-if="
												Array.isArray(salesSerivceRate) &&
												salesSerivceRate.length &&
												salesSerivceRate[0].salesServiceFeeAlgorithm === '4'
											"
											>(若选择浮动销售服务费率，则填写基本销售服务费备注)</span
										>
									</span>
								</el-form-item>
							</el-form>
						</el-popover>
					</div>
					<div class="div3">
						<el-input
							type="textarea"
							v-model="salesSerivceRate[0].remark"
							:disabled="isBaseDisabled || salesSerivceRate[0].salesServiceFeeAlgorithm === '1'"
							show-word-limit
							style="width: 100%"
						/>
					</div>
				</li>
			</template>

			<li class="lis">
				<div class="div1">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.isAchieveReward">
						<el-form slot="reference">
							<el-form-item label="是否提取业绩报酬" required>
								<span v-if="['6'].includes(dataType)">
									<span style="color: red" v-if="publicCompare('isAchieveReward', '是否提取业绩报酬', 'rateInfo')">(未复核)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div3">
					<el-radio-group
						v-model="rateInfo.isAchieveReward"
						:disabled="isBaseDisabled"
						@change="clearChange(['rewardExplain', 'accrualDatum', 'accrualRatio', 'accrualPointTime'])"
					>
						<el-radio label="0">是</el-radio>
						<el-radio label="1">否</el-radio>
					</el-radio-group>
					<div class="blurmsg" v-if="isCheck && !!!rateInfo.isAchieveReward">请确认是否提取业绩报酬</div>
				</div>
			</li>

			<li class="lis" v-if="rateInfo.isAchieveReward === '0'">
				<div class="div1">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.accrualPointTime">
						<el-form slot="reference">
							<el-form-item label="计提时点" required>
								<span v-if="['6'].includes(dataType)">
									<span style="color: red" v-if="publicCompare('accrualPointTime', '计提时点', 'rateInfo')">(未复核)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div3">
					<el-checkbox-group v-model="timePoint" style="width: 100%" @change="focusUpdate">
						<el-checkbox label="1" :disabled="isBaseDisabled">不提取</el-checkbox>
						<el-checkbox label="2" :disabled="isBaseDisabled">资产管理计划投资者赎回时</el-checkbox>
						<el-checkbox label="3" :disabled="isBaseDisabled">资产管理计划分红时计提</el-checkbox>
						<el-checkbox label="4" :disabled="isBaseDisabled">资产管理计划固定开放日计提</el-checkbox>
						<el-checkbox label="5" :disabled="isBaseDisabled">资产管理计划临时开放日计提</el-checkbox>
						<el-checkbox label="6" :disabled="isBaseDisabled">资产管理计划到期计提</el-checkbox>
						<el-checkbox label="7" :disabled="isBaseDisabled">其他计提时点</el-checkbox>
					</el-checkbox-group>
					<div class="blurmsg" v-if="isCheck && !timePoint.length">请选择计提时点</div>
				</div>
			</li>

			<li class="lis" v-if="rateInfo.isAchieveReward === '0'">
				<div class="div2">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.accrualDatum">
						<el-form slot="reference">
							<el-form-item label="计提基准" required>
								<span v-if="['6'].includes(dataType)">
									<span style="color: red" v-if="publicCompare('accrualDatum', '计提基准', 'rateInfo')">(未复核)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div2">
					<el-input v-model="rateInfo.accrualDatum" :disabled="isBaseDisabled" @input="focusUpdate"></el-input>
					<div class="blurmsg" v-if="isCheck && !!!rateInfo.accrualDatum">请输入计提基准</div>
				</div>
				<div class="div2">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.accrualRatio">
						<el-form slot="reference">
							<el-form-item label="计提比例" required>
								<span v-if="['6'].includes(dataType)">
									<span style="color: red" v-if="publicCompare('accrualRatio', '计提比例', 'rateInfo')">(未复核)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div2">
					<el-input v-model="rateInfo.accrualRatio" :disabled="isBaseDisabled" @input="focusUpdate"></el-input>
					<div class="blurmsg" v-if="isCheck && !!!rateInfo.accrualRatio">请输入计提比例</div>
				</div>
			</li>

			<li class="lis" v-if="rateInfo.isAchieveReward === '0'">
				<div class="div2">
					<el-popover placement="top-start" width="200" trigger="hover" :content="$store.getters.hoverPerty.rateInfo.rewardExplain">
						<el-form slot="reference">
							<el-form-item label="业绩报酬说明" required>
								<span v-if="['6'].includes(dataType)">
									<span style="color: red" v-if="publicCompare('rewardExplain', '业绩报酬说明', 'rateInfo')">(未复核)</span>
								</span>
							</el-form-item>
						</el-form>
					</el-popover>
				</div>
				<div class="div3">
					<el-input
						type="textarea"
						@input="focusUpdate"
						v-model="rateInfo.rewardExplain"
						:disabled="isBaseDisabled"
						show-word-limit
						style="width: 100%"
					/>
					<div class="blurmsg" v-if="isCheck && !!!rateInfo.rewardExplain">请输入业绩报酬说明</div>
				</div>
			</li>
		</ul>

		<div style="display: flex; justify-content: space-between; flex-wrap: wrap">
			<div style="width: 48%">
				<h2 style="margin-top: 40px">认购费率</h2>
				<ul class="ulscom">
					<li class="list1" style="width: 100%">
						<div class="list1item">
							<el-popover
								placement="top-start"
								width="200"
								trigger="hover"
								:content="$store.getters.hoverPerty.rateInfo.ordinarySubscription"
							>
								<span slot="reference">
									普通认购
									<span style="color: rgb(0, 128, 0)"> [ E 表示正无穷 ]</span>
									<span style="color: red; margin-left: 10px">{{ subRateMsg }}</span>
									<span v-if="['6'].includes(dataType)">
										<span
											style="color: red"
											v-if="
												Array.isArray(subRateList) &&
												subRateList.length &&
												feeRateCCompare(subRateList[0].feeRateType, '普通认购')
											"
											>(未复核)</span
										>
									</span>
								</span>
							</el-popover>
						</div>
						<div class="list1item">
							<div style="border-left: none" class="list1itemChild">认购金额（含认购费）</div>
							<div class="list1itemChild">认购金额（含认购费）</div>
							<div class="list1itemChild">认购金额（含认购费）</div>
							<div class="list1itemChild">认购费率</div>
						</div>
						<div class="list1item" v-for="(item, index) in subRateList" :key="index + 'a'">
							<div style="border-left: none" class="list1itemChild">
								<el-input v-model="item.startSection" disabled @input="refresh(subRateList, 'subRateMsg')" />
							</div>
							<div class="list1itemChild">≤ 金额（万元）＜</div>
							<div class="list1itemChild">
								<el-input v-model="item.endSection" :disabled="isBaseDisabled" @input="refresh(subRateList, 'subRateMsg')" />
							</div>
							<div class="list1itemChild">
								<el-input v-model="item.feeRate" :disabled="isBaseDisabled" @input="refresh(subRateList, 'subRateMsg')">
									<el-select
										v-model="item.feeRateUnit"
										slot="append"
										:disabled="isBaseDisabled"
										@input="refresh(subRateList, 'subRateMsg')"
									>
										<el-option label="%" value="1"></el-option>
										<el-option label="元/笔" value="2"></el-option>
									</el-select>
								</el-input>
							</div>
						</div>
					</li>
				</ul>
			</div>

			<div style="width: 48%">
				<h2 style="margin-top: 40px" slot="reference">
					前端-申购费率
					<el-checkbox style="color: #409eff; font-weight: 600" v-model="rearRndRadio"
						>{{ isBaseDisabled ? '查看' : '编辑' }}后端-普通申购费率</el-checkbox
					>
				</h2>
				<ul class="ulscom">
					<li class="list1" style="width: 100%">
						<div class="list1item">
							<el-popover
								placement="top-start"
								width="200"
								trigger="hover"
								:content="$store.getters.hoverPerty.rateInfo.generalSubscription"
							>
								<span slot="reference">
									前端-普通申购
									<span style="color: rgb(0, 128, 0)">[ E 表示正无穷 ]</span>
									<span style="color: red; margin-left: 10px">{{ applyRateMsg }}</span>
									<span v-if="['6'].includes(dataType)">
										<span
											style="color: red"
											v-if="
												Array.isArray(applyRateList) &&
												applyRateList.length &&
												feeRateCCompare(applyRateList[0].feeRateType, '前端-普通申购')
											"
											>(未复核)</span
										>
									</span>
								</span>
							</el-popover>
						</div>
						<div class="list1item">
							<div style="border-left: none" class="list1itemChild">申购金额</div>
							<div class="list1itemChild">申购金额</div>
							<div class="list1itemChild">申购金额</div>
							<div class="list1itemChild">申购费率</div>
						</div>
						<div class="list1item" v-for="(item, index) in applyRateList" :key="index + 'c'">
							<div style="border-left: none" class="list1itemChild">
								<el-input v-model="item.startSection" disabled @input="refresh(applyRateList, 'applyRateMsg')" />
							</div>
							<div class="list1itemChild">≤ 金额（万元）＜</div>
							<div class="list1itemChild">
								<el-input v-model="item.endSection" :disabled="isBaseDisabled" @input="refresh(applyRateList, 'applyRateMsg')" />
							</div>
							<div class="list1itemChild">
								<el-input v-model="item.feeRate" :disabled="isBaseDisabled" @input="refresh(applyRateList, 'applyRateMsg')">
									<el-select
										v-model="item.feeRateUnit"
										slot="append"
										:disabled="isBaseDisabled"
										@input="refresh(applyRateList, 'applyRateMsg')"
									>
										<el-option label="%" value="1"></el-option>
										<el-option label="元/笔" value="2"></el-option>
									</el-select>
								</el-input>
							</div>
						</div>
					</li>
				</ul>
			</div>
			<span v-if="['6'].includes(dataType)" style="width: 0; height: 0">
				<span v-if="!!rearRndRateList && Array.isArray(rearRndRateList) && rearRndRateList.length">
					{{ feeRateCCompare(rearRndRateList[0].feeRateType, '后端-普通申购') ? '' : '' }}
				</span>
			</span>
			<div style="width: 48%" v-show="rearRndRadio">
				<h2 style="margin-top: 16px">后端-申购费率</h2>
				<ul class="ulscom">
					<li class="list1" style="width: 100%">
						<div class="list1item">
							<el-popover
								placement="top-start"
								width="200"
								trigger="hover"
								:content="$store.getters.hoverPerty.rateInfo.obEndSubscription"
							>
								<span slot="reference">
									后端-普通申购
									<span style="color: rgb(0, 128, 0)">[ E 表示正无穷 ]</span>
									<span style="color: red; margin-left: 10px">{{ rearRndMsg }}</span>
									<span v-if="['6'].includes(dataType)">
										<span
											style="color: red"
											v-if="
												Array.isArray(rearRndRateList) &&
												rearRndRateList.length &&
												feeRateCCompare(rearRndRateList[0].feeRateType, '后端-普通申购')
											"
											>(未复核)</span
										>
									</span>
								</span>
							</el-popover>
						</div>
						<div class="list1item">
							<div style="border-left: none" class="list1itemChild">持有期限</div>
							<div class="list1itemChild">持有期限</div>
							<div class="list1itemChild">持有期限</div>
							<div class="list1itemChild">申购费率</div>
						</div>
						<div class="list1item" v-for="(item, index) in rearRndRateList" :key="index + 'c'">
							<div style="border-left: none" class="list1itemChild">
								<el-input
									v-model="item.startSection"
									:disabled="index > 0 || isBaseDisabled"
									@input="refresh(rearRndRateList, 'rearRndMsg')"
								/>
							</div>
							<div class="list1itemChild">≤ 日期 ＜</div>
							<div class="list1itemChild">
								<el-input v-model="item.endSection" :disabled="isBaseDisabled" @input="refresh(rearRndRateList, 'rearRndMsg')" />
							</div>
							<div class="list1itemChild">
								<el-input v-model="item.feeRate" :disabled="isBaseDisabled" @input="refresh(rearRndRateList, 'rearRndMsg')">
									<el-select
										v-model="item.feeRateUnit"
										slot="append"
										:disabled="isBaseDisabled"
										@input="refresh(rearRndRateList, 'rearRndMsg')"
									>
										<el-option label="%" value="1"></el-option>
										<el-option label="元/笔" value="2"></el-option>
									</el-select>
								</el-input>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>

		<div style="display: flex; justify-content: space-between">
			<div style="width: 48%">
				<h2 style="margin-top: 40px">赎回费率</h2>
				<ul class="ulscom">
					<li class="list1" style="width: 100%">
						<div class="list1item">
							<el-popover
								placement="top-start"
								width="200"
								trigger="hover"
								:content="$store.getters.hoverPerty.rateInfo.ordinaryRedemption"
							>
								<span slot="reference">
									普通赎回
									<span style="color: rgb(0, 128, 0)">[ E 表示正无穷 ]</span>
									<span style="color: red; margin-left: 10px">{{ ransomRateMsg }}</span>
									<span v-if="['6'].includes(dataType)">
										<span
											style="color: red"
											v-if="
												Array.isArray(ransomRateList) &&
												ransomRateList.length &&
												feeRateCCompare(ransomRateList[0].feeRateType, '普通赎回')
											"
											>(未复核)</span
										>
									</span>
								</span>
							</el-popover>
						</div>
						<div class="list1item">
							<div style="border-left: none" class="list1itemChildend">持有期限</div>
							<div class="list1itemChildend">持有期限</div>
							<div class="list1itemChildend">持有期限</div>
							<div class="list1itemChildend">赎回费率</div>
							<div class="list1itemChildend">归基金资产比例</div>
						</div>
						<div class="list1item" v-for="(item, index) in ransomRateList" :key="index + 'e'">
							<div style="border-left: none" class="list1itemChildend">
								<el-input
									v-model="item.startSection"
									:disabled="index > 0 || isBaseDisabled"
									@input="refresh(ransomRateList, 'ransomRateMsg')"
								/>
							</div>
							<div class="list1itemChildend">≤ 日期 ＜</div>
							<div class="list1itemChildend">
								<el-input v-model="item.endSection" :disabled="isBaseDisabled" @input="refresh(ransomRateList, 'ransomRateMsg')" />
							</div>
							<div class="list1itemChildend">
								<el-input v-model="item.feeRate" :disabled="isBaseDisabled" @input="refresh(ransomRateList, 'ransomRateMsg')">
									<el-select
										v-model="item.feeRateUnit"
										slot="append"
										:disabled="isBaseDisabled"
										@input="refresh(ransomRateList, 'ransomRateMsg')"
									>
										<el-option label="%" value="1"></el-option>
										<el-option label="元/笔" value="2"></el-option>
									</el-select>
								</el-input>
							</div>
							<div class="list1itemChildend">
								<el-input v-model="item.belongFundRatio" :disabled="isBaseDisabled" @input="refresh(ransomRateList, 'ransomRateMsg')">
									<el-select
										v-model="item.belongFundRatioUnit"
										slot="append"
										:disabled="isBaseDisabled"
										@input="refresh(ransomRateList, 'ransomRateMsg')"
									>
										<el-option label="%" value="1"></el-option>
									</el-select>
								</el-input>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</div>
</template>
<script>
import { getEnum, jsonArray } from '@/api/productApi/file'
import { saveRate } from '@/api/productApi/infoMain'
import { publicCompare, feeRateCCompare } from '@/views/infoMain/specialList/components/dataCheck'
import { rateReview } from '@/views/infoMain/specialList/components/dataReview'
import { mergeRate, initZationm, RateVerification, valueCheckByRule } from './rateInfo'
import { digitalInput } from '@/utils/DigitalInput'
import { rateInfo } from '../../default'
export default {
	props: {
		setpFunc: {
			type: Function,
			default: Function
		},
		fundSysCode: {
			type: String,
			default: ''
		},
		dataType: {
			type: String,
			default: ''
		},
		haveYouWalked: {
			type: Object,
			default: Object
		}
	},
	data() {
		return {
			rateInfo: {
				deferRaiseDate: false,
				isAchieveReward: '',
				custodyFeeAlgorithm: '1'
			},
			productDictList: [], // 字典列表
			isBaseDisabled: false,
			manageRate: [{ feeRateUnit: '1', feeRateType: '9', feeRateId: 1 }], // 管理费率
			trusteeRate: [{ feeRateUnit: '1', feeRateType: '7', feeRateId: 1 }], // 托管费率
			salesSerivceRate: [{ feeRateUnit: '1', feeRateType: '8', feeRateId: 1 }], // 销售服务费率,
			timePoint: [],
			subRateList: [], // 普通认购费率列表
			applyRateList: [], // 前端-普通申购
			rearRndRateList: [], // 后端-普通申购
			ransomRateList: [], // 普通赎回
			subRateMsg: '', // 普通认购费费率非法提示字段
			applyRateMsg: '', // 前端-普通申购费率非法提示字段
			ransomRateMsg: '', // 普通赎回费率非法提示字段
			rearRndMsg: '', // 后端-普通申购费费率非法提示字段
			rearRndRadio: false,
			isCheck: false,
			publicCompare,
			feeRateCCompare
		}
	},

	mounted() {
		this.getProductDictList()
	},

	computed: {
		fundCode() {
			return this.$store.state.fundStep.specialBaseInfo.fundCode
		}
	},

	methods: {
		focusUpdate() {
			this.$forceUpdate()
		},

		defaultValue() {
			// 当非查看状态时，赋值默认值
			setTimeout(() => {
				if ((this.dataType === '1' || this.dataType === '') && !this.haveYouWalked.rateMode) {
					rateInfo.forEach(item => {
						if (!this.rateInfo[item.key]) {
							this.$set(this.rateInfo, item.key, item.value)
						}
					})
				}
			})
		},

		// 重新申请将数据集中在store
		updateStoreData() {
			const arr = [...this.timePoint]
			if (arr.length) {
				this.rateInfo.accrualPointTime = arr.toString()
			}
			this.$store.state.fundStep.specialtTotalData.productFundApply.rateInfo = this.rateInfo
			this.$store.state.fundStep.specialtTotalData.productFundApply.rateInfo.feeRateInfoList = mergeRate(this)
		},

		// 父组件调用事件
		isBaseDisabledCom(data, msgShow) {
			this.isBaseDisabled = data
			this.isCheck = msgShow
		},

		edit(obj) {
			const data = jsonArray(obj)
			if (data) {
				initZationm(data, this)
			}
			this.defaultValue()
		},

		scale(obj, property) {
			// 规定只能填写数字、小数点
			if (obj[property]) {
				obj[property] = digitalInput(obj[property])
			}
		},

		saleChan() {
			if (this.salesSerivceRate[0].salesServiceFeeAlgorithm === '1') {
				this.salesSerivceRate[0].feeRate = ''
				this.salesSerivceRate[0].remark = ''
			}
		},

		// 完善信息切换步骤时保存切换前页面数据
		async switchingSteps() {
			this.rateInfo.accrualPointTime = [...this.timePoint].toString()
			if (this.subRateMsg === '' && this.applyRateMsg === '' && this.ransomRateMsg === '' && this.rearRndMsg === '') {
				const rateInfo = this.returnSaveData()
				await saveRate(rateInfo).then(res => {
					if (res.msgCode === 'Y') {
						this.$emit('setpFunc', '1', this.fundSysCode, '', 1)
					}
				})
				return true
			} else {
				this.$message({ message: '费率列表填写不满足条件,请修正!', type: 'error' })
				return false
			}
		},

		ValidationRequired() {
            this.rateInfo.accrualPointTime = [...this.timePoint].toString()
			this.rateInfo.feeRateInfoList = mergeRate(this)
			const baseField = rateReview(this.rateInfo)
			if (!(this.subRateMsg === '' && this.applyRateMsg === '' && this.ransomRateMsg === '' && this.rearRndMsg === '')) {
				this.$message({ message: '费率验证非法，请重新确认', type: 'error' })
				return {}
			}
			return baseField
		},

		// 新增:【保存】和【下一步】
		startDown(type) {
			this.rateInfo.accrualPointTime = [...this.timePoint].toString()
			if (this.subRateMsg === '' && this.applyRateMsg === '' && this.ransomRateMsg === '' && this.rearRndMsg === '') {
				const rateInfo = this.returnSaveData()
				this.isCheck = true
				this.CustomtextComfirm(() => {
					saveRate(rateInfo).then(res => {
						if (res.msgCode === 'Y') {
							if (type === '下一步') {
								this.$emit('setpFunc', '1', this.fundSysCode, '', 0)
							} else {
								this.$emit('setpFunc', '1', this.fundSysCode, '', 1)
							}
							this.$message({ type: 'success', message: res.msg })
						}
					})
				}, `${!rateReview(this.rateInfo).length ? '此操作将永久提交已编辑数据，是否继续' : `必填项 “ ${rateReview(this.rateInfo).join('、')} ” 未填写，是否确认提交`}？`)
			} else {
				this.$message({ message: '费率列表填写不满足条件,请修改后提交!', type: 'error' })
			}
		},

		returnSaveData() {
			const params = {}
			params.productFundApply = {}
			params.productFundApply.rateInfo = this.rateInfo
			params.fundRaiseType = '2'
			params.fundSysCode = this.fundSysCode
			params.productFundApply.rateInfo.feeRateInfoList = mergeRate(this)
			return params
		},

		// 查询字典列表
		getProductDictList() {
			getEnum(['feeRateAlgorithm', 'custodyFeeAlgorithm', 'salesServiceFeeAlgorithm']).then(res => {
				if (res.msgCode === 'Y') {
					this.productDictList = res.data.body
				}
			})
		},

		refresh(list, showMsg) {
			// 验证费率
			valueCheckByRule(list, showMsg)
			RateVerification(list, showMsg, this)
		},

		clearChange(list) {
			// 清楚联动字段
			this.timePoint = []
			list.forEach(key => {
				this.rateInfo[key] = ''
			})
		},

		changeFeeRateAlgorith() {
			if (this.dataType === '1' || this.dataType === '3' || this.dataType === '5' || this.dataType === '7') {
				if (this.rateInfo.feeRateAlgorithm === '1') {
					this.rateInfo.isAchieveReward = '0'
				} else if (this.rateInfo.feeRateAlgorithm === '0') {
					this.clearChange(['rewardExplain', 'accrualRatio', 'accrualDatum', 'accrualPointTime', 'isAchieveReward'])
				}
			}
		}
	}
}
</script>
<style lang="scss" scoped src='./index.scss'>
</style>
